package com.x.client.bean

import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize

/**
 *  Creator : GG
 *  Time    : 2017/11/22
 *  Mail    : gg.jin.yu@gmail.com
 *  Explain :
 */
@Parcelize
data class CarImage(
        @SerializedName("carId") var carId: String? = "", //123
//        @SerializedName("imageId") var imageId: String? = "", //17112118183928439410352566491473
        @SerializedName("imageKey") var imageKey: String? = "", //left_anterior
        @SerializedName("imageSeq") var imageSeq: Int? = 0, //1
        @SerializedName("imageUrl") var imageUrl: String? = null,//http://47.93.47.216:8083/group1/M00/00/01/wKgAvFoSqo2AbAxVAAGLtchij08999.png
        var localPath: String? = null,

        var states: Boolean = true
) : Parcelable {

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is CarImage) return false

        if (imageKey != other.imageKey) return false

        return true
    }

    fun getKey(): String? {
        when (imageKey) {
            VIN -> return vin
            RIGHT_REAR -> return right_rear
            DRIVING_SEAT -> return driving_seat
            CONTROL_BOOTH -> return control_booth
            ODOGRAPH -> return odograph
            LEFT_ANTERIOR -> return left_anterior
            OPEN_TRUNK -> return open_trunk
            ENGINE_BAY -> return engine_bay
            GEAR_LEVER -> return gear_lever
            TYRE -> return tyre

            INSURANCE -> return insurance
            REGISTRATION_LICENSE -> return registration_license
            VEHICLE_LICENSE -> return vehicle_license
        }
        return null
    }


    companion object {

        const val add = 1 //add icon

        const val image = 2//image

        //车辆图片

        //VIN
        const val vin = "VIN"
        const val VIN = "vin"
        //右后
        const val RIGHT_REAR = "right_rear"
        const val right_rear = "右后"
        //驾驶座椅
        const val DRIVING_SEAT = "driving_seat"
        const val driving_seat = "驾驶座椅"
        //控制室
        const val CONTROL_BOOTH = "control_booth"
        const val control_booth = "控制室"
        //里程表
        const val ODOGRAPH = "odograph"
        const val odograph = "里程表"
        //左前
        const val LEFT_ANTERIOR = "left_anterior"
        const val left_anterior = "左前(首图)"
        //打开后备箱
        const val OPEN_TRUNK = "open_trunk"
        const val open_trunk = "打开后备箱"
        //发动机全景
        const val ENGINE_BAY = "engine_bay"
        const val engine_bay = "发动机全景"
        //右侧
//        const val RIGHT_SIDE = "right_side"
//        const val right_side = "右侧"
        // 轮胎
        const val TYRE = "tyre"
        const val tyre = "轮胎"
        //GEAR_LEVER
        const val GEAR_LEVER = "gear_lever"
        const val gear_lever = "变速档杆"

        //证件图片

        //保单
        const val INSURANCE = "insurance"
        const val insurance = "保单"
        //登记证
        const val REGISTRATION_LICENSE = "registration_license"
        const val registration_license = "登记证"
        //行驶证
        const val VEHICLE_LICENSE = "vehicle_license"
        const val vehicle_license = "行驶证"

    }

}